package org.itworks.biodev.model;

import java.util.Vector;

public class ProductSpecificity {
	private Integer id;
	private String label;
	private int productCategoryId;
	private ProductCategory productCategory;
	
	/*public ProductSpecifity() {
		
	}*/
	
	public Integer getId() {
		return id;
	}
	
	public String getLabel() {
		return label;
	}
	
	public void setLabel(String label) {
		this.label = label;
	}
	

	public int getProductCategoryId() {
		return productCategoryId;
	}

	public void setProductCategoryId(int productCategoryId) {
		this.productCategoryId = productCategoryId;
		try {
			productCategory = ProductCategoryTable.getInstance().find(this.productCategoryId);
		} catch(Exception e) {
			productCategory = null;
		}
	}

	public ProductCategory getProductCategory() throws Exception {
		if(productCategory == null) {
			productCategory = ProductCategoryTable.getInstance().find(this.productCategoryId);
		}
		return productCategory;
	}

	public void setProductCategory(ProductCategory productCategory) {
		this.productCategory = productCategory;
		this.productCategoryId = productCategory.getId();
	}
}
